package com.zebra.remoting.protocol;


import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

public enum CommandType {

    BASIS(1), //主要是框架上面的命令 ，还有 广播等
    LOBBY(2),
    GAME(3)
     ;
    private int value;

    CommandType(int value) {
        this.value = value;
    }


    private final static Map<Integer, CommandType> stateMap
            = Arrays.stream(CommandType.values()).collect(Collectors.toMap(CommandType::value, t -> t));


    public int value() {
        return this.value;
    }

    public static CommandType valueOf(int value) {
       return stateMap.get(value);
    }

}